<?php
/**
 * TestAction 
 * 
 * 必须实现方法action().并且文件名要与类名保持一致.
 *
 */
class ShopAction{
	
	public function action($_get){  //$_get是URL参数的数组和$_GET一样.如果不需要可以省略

		require_once "Action/common.php";
		$tempDir = 'templates/'.$d;
		
		$user = "";
		if($_get['user']){$user = $_get['user'];}

		$Taoapi->method = 'taobao.shop.get';
		$Taoapi->fields = 'sid,cid,nick,title,desc,bulletin,pic_path,created,modified';
		$Taoapi->nick = mb_convert_encoding($user,"UTF-8", "gb2312");

		//需要更多的字段可以登陆 taoapi.com 进行配置生成
		$TaobaokeData = $Taoapi->Send('get','xml')->getArrayData();



		$shop = new Taoapi;

		//淘客店铺转换(taobao.taobaoke.shops.convert)

		$shop->method = 'taobao.taobaoke.shops.convert';

		$shop->fields = 'user_id,shop_title,click_url,shop_commission.rate';

		$shop->sids = $TaobaokeData['shop']['sid'];

		$shop->nick = USERNICK;

		//需要更多的字段可以登陆 taoapi.com 进行配置生成
		$shopData = $shop->Send('get','xml')->getArrayData();
		
		$mm_title = $shopData['taobaoke_shops']['taobaoke_shop']['shop_title'];
		$mm_url = $shopData['taobaoke_shops']['taobaoke_shop']['click_url'];
		$mm_jumpurl = "window.location = '".$mm_url."'";
		if(isBaidu()){
			$mm_url="#";
			$mm_jumpurl = ""; //"document.write('".FLAG.$mm_title."');";
			$mm_title = FLAG;
		}
		
		$tpl->assign("mm_url",$mm_url);
		$tpl->assign("mm_jumpurl",$mm_jumpurl);
		$tpl->assign("mm_title",$mm_title);
		$tpl->assign("mm_webname",SITETITLE);
		$tpl->display("mm_jump.html","shops");	

	}
}
?>